package indi.kane.demandlist.vo;

/**
 * @ClassName: ResultVo
 * @Author: kane
 * @Date: 2019-11-12 5:04 下午
 * @Description:
 */
public class ResultVo {
    public final static String SUCCESS = "成功";
    public final static int SUCCESS_CODE=200;
    public final static int SUCCESS_CODE_WRONG=0;
    public final static String FAILED = "失败";
    public final static int FAILED_EXCEPTION_CODE = -1;
    public final static int NEEDLOGIN = -2;



    private Integer code;
    private Object data;
    private String msg;

    private Integer pageSize;
    private Integer currentPage;
    private Integer total;
    private Integer totalPage;

    public ResultVo() {
    }

    public ResultVo(Integer code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    /**
     * 成功响应
     *
     * @param data 成功数据
     * @return
     */
    public static ResultVo success_wrong(Object data) {
        return new ResultVo(SUCCESS_CODE_WRONG, data, SUCCESS);
    }

    public static ResultVo success(Object data) {
        return new ResultVo(SUCCESS_CODE, data, SUCCESS);
    }

    public static ResultVo success(Integer code,Object data ,String msg) {
        return new ResultVo(code, data, msg);
    }



    /**
     * 响应失败
     * @param msg 错误信息
     * @return
     */
    public static ResultVo failed(Integer code,String msg) {
        return new ResultVo(code, FAILED, msg);
    }

    public static ResultVo failed(Integer code, Object data,String msg) {
        return new ResultVo(code, data, msg);
    }

    public static ResultVo failed_exception(String msg) {
        return new ResultVo(FAILED_EXCEPTION_CODE, null, msg);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }
}
